home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 181
/
181.d81
/
brass ring
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
22KB
|
684 lines
1 rem copyrighted by maurice jones, november 1996
2 nm$="brass ring":nn$="amcgs": dv=peek(186):ifdv<8thendv=8
3 print"[159][147]":poke53280,0:poke53281,0:poke788,49:tq=ti:poke53371,0:mt=49152
4 sys57812"amcgs.a font",dv,0:poke780,0:poke781,0:poke782,8:sys65493
12 open2,dv,2,nm$+".opts,p,r":input#2,k3,sd,so,cc,sk
14 input#2,bd,fb,mu,wg,pk,rd,kc,kc%(0):close2
17 gosub5500:poke53265,27:onmu+1goto500,482
18 :
19 rem brancher
20 onsd+1goto70,80
24 :
25 rem charge
26 a$="251331421502421502":poke53370,0
27 t=87:pokef+6,96:pokef+24,15
28 fori=1to18step3
29 pokef+1,val(mid$(a$,i,2)):pokef+4,33
30 forj=1tot*val(mid$(a$,i+2,1)):next
31 pokef+4,0:next:fori=ftof+24
32 pokei,0:next:poke53371,0:return
34 rem menu brancher
35 sysmt:poke53269,1
37 sysmt+9:ifl2%then57
41 i=1:geta$:ifa$=""then37
45 ifi>len(ch$)then37
49 ifa$=mid$(ch$,i,1)then59
53 i=i+1:goto45
57 ifcx%<x1+2orcx%>x2-2orcy%<y1+3orcy%>y2-1then37
58 i=(cy%-(y1)-1)/2
59 return
63 :
64 rem print at
65 x=x(i):y=y(i)
66 poke211,x:poke214,y:sys58732:return
68 :
69 rem keybord brancher
70 i=1:geta$:ifa$=""then76
71 ifi>len(ch$)then70
72 ifa$=mid$(ch$,i,1)thenreturn
73 i=i+1:goto71
76 ifjj=nc-2thenjj=-1
77 jj=jj+1:j%=jj+int(rnd(1)*(nc-jj)):temp=s(jj):s(jj)=s(j%):s(j%)=temp:goto70
78 :
79 rem mouse brancher
80 sysmt+9:ifl2%=1orr2%=1 theni=rg%:return
81 ifjj=nc-2thenjj=-1
82 jj=jj+1:j%=jj+int(rnd(1)*(nc-jj)):temp=s(jj):s(jj)=s(j%):s(j%)=temp:goto 80
88 :
89 rem wrong choice sound
90 poke53370,0:pokef+24,15:pokef+8,4:pokef+12,63:pokef+13,17:pokef+11,33
91 fori=1to100:next:pokef+11,32
92 y= 1:x= 0 :gosub66:printwm$(wm);:fori=1to150:next
93 poke53371,0:return
94 :
95 rem tone & message
96 poke53370,0:pokef+24,15:pokef+5,4:pokef+6,12
97 pokef+4,23:pokef+15,100:pokef+4,20:pokef+1,30:fork=1to350:next:pokef+6,0
98 pokef+4,129:goto92
109 :
110 rem special turn from deck not a sub
111 tc=b%(t2,c(t2)):ts=fns(tc):tv=fnv(tc)
115 gosub270:onplgoto119,640
119 ift2>sf+3orgf=sf+3thenwm=3:gosub90:goto534
120 t2=t2+4:goto620
121 :
122 rem auto
123 tc=b%(t2,c(t2)):ts=fns(tc):tv=fnv(tc)
127 gosub270:onplgoto141,131
131 fork=c(fr)-1to1step-1
133 iffns(b%(fr,k))<>fsthen139
135 iffnv(b%(fr,k))<>fnv(b%(fr,k+1))+1then139
137 nextk
139 mm=k+1:goto1240
141 ift2>sf+3orgf=sf+3thenwm=3:gosub90:goto534
143 t2=t2+4:goto123
149 :
150 rem fill empty spaces
151 iffr<=2or(c(0)=0andc(1)=0)then534
154 ifc(2)>0then164
155 ifc(1)>0then160
156 c(fr)=c(fr)+1:b%(fr,c(fr))=b%(0,c(0)):c(0)=c(0)-1:i=0:gosub250:gosub230
157 ifc(0)=0thensysmt+30,x(0),x(0)+3,y(0),y(0)+4,kt,sk
158 i=fr:gosub200:goto534
160 c(fr)=c(fr)+1:b%(fr,c(fr))=b%(1,c(1)):c(1)=c(1)-1:i=1:gosub200
162 goto158
164 c(fr)=c(fr)+1:b%(fr,c(fr))=b%(2,c(2)):c(2)=c(2)-1:i=2
165 ifc(2)=0theni=2:gosub65: gosub224:gosub230:goto158
166 gosub250:gosub230: goto158
168 :
169 rem erases pile i
170 ifks(i)=2then174
172 mx=y(i)+sp(i)*(mx(i)-1)+4:sysmt+30,x(i),x(i)+3,y(i),mx,kt,sk:goto177
174 mx=x(i)+sp(i)*(mx(i)-1)+3:sysmt+30,x(i),mx,y(i),y(i)+4,kt,sk
177 return
178 :
179 rem magic :202 other place 203:any card
180 onks(i)goto181,190
181 x=x(i):y=y(i)+sp(i)*(c(i)-1)
182 ify>y(i)+sp(i)*(mx(i)-1)theny=y(i)+sp(i)*(mx(i)-1)
184 gosub66:goto202
190 y=y(i):x=x(i)+sp(i)*(c(i)-1)
192 ifx>x(i)+sp(i)*(mx(i)-1)thenx=x(i)+sp(i)*(mx(i)-1)
194 gosub66:goto202
200 x=x(i):y=y(i):gosub66:ifc(i)=0thengosub170
202 ca=b%(i,c(i)):ifc(i)=0then224
203 poke53370,0:ifso=1then220
214 pokef+1,50:pokef+24,12:pokef+4,129:fort=1to15:next:pokef+4,128:pokef+5,0
220 print"[146]";:printst$(ca);:poke53371,0:return
224 sysmt+30,x,x+3,y,y+4,kt,sk:return
228 :
229 rem print count at i
230 k=len(str$(c(i))):sysmt+30,x(i)-2,x(i)-1,y(i)+3,y(i)+3,kt,sk
234 ifc(i)=0then246
236 x=x(i)-k+1:y=y(i)+3
238 gosub66:print"[156]"right$(str$(c(i)),k-1):return
244 gosub66:print"[156]"right$(str$(c(i)-1),k-1):return
246 ifi=0andc(0)=0andre<kdthensysmt+36,7,255,15:return
247 ifc(0)=0then sysmt+30,x(0),x(0)+3,y(0),y(0)+4,kt,sk:return
248 : return
249 rem prints deck at i
250 print"[146]":gosub65
252 poke53370,0:ifso=1then256
254 pokef+1,50:pokef+24,12:pokef+4,129:fort=1to15:next:pokef+4,128:pokef+5,0
256 poke646,cc:printbk$:sysmt+30,x+1,x+2,y+1,y+3,kc%(kc),cc:poke53371,0:return
258 :
259 rem redeal
260 kd=fl(2):ifrd=0thenkd=fl(3)
261 ifre= kdthenwm=9:gosub90:return
262 x=c(1):fori=1tox:b%(0,x)=b%(1,i):x=x-1:next:c(0)=c(1):c(1)=0
263 i=1:gosub65:sysmt+30,x,x+ht+2,y,y+4,kt,sk:i=0:gosub250:gosub230
264 ifht=3thenreturn
265 re=re+1
266 return
268 :
269 will it play
270 pl=1:ifts<>fsandc(t2)>0thenreturn
271 if(t2<1ort2=2)or(t2>1andfv=0andt2<>sf+fs)thenreturn
272 ift2=1andfr=2thenreturn
273 ifc(2)>0andt2=1andfs=tsand(fv=tv+1orfv=tv-1)thenpl=2:return
274 ift2=1thenreturn
275 ift2> 2andt2<sfthenreturn
276 fori=0to4:ifpl%(t2-sf ,i)=frthen279
277 next
278 return
279 ifc(t2)=0andfv=0thenpl=2:return
280 ifc(t2)>0andtc+1=fcthenpl=2:return
282 return
288 :
289 rem play from klon type waste
290 c(t2)=c(t2)+1:b%(t2,c(t2))=b%(fr,c(fr)):c(fr)=c(fr)-1:
291 y=y(1):x=x(1)+nt-1 :gosub66
292 sysmt+30,x,x+3,y,y+4,kt,sk
294 nt=nt-1:ifnt<1thennt=1
296 i=1:y=y(1):x=x(1)+nt-1:gosub66:gosub202
297 i=t2:gosub180:return
298 :
299 rem print stats
300 x1=2:x2=15:y1=8:y2=19:cl=cc:gosub2100
302 x=x1+2:y=y1+2
306 gosub66:print"[149]played";
307 x=x1+12-len(str$(t6)):gosub66:print"[144]"t6
308 x=x1+2:y=y+2:gosub66:print"spins";
309 x=x1+12-len(str$(pn)):gosub66:print"[144]"pn
310 x=x1+2:y=y+1:gosub66:print"score";
311 x=x1+12-len(str$(fs)):gosub66:print"[144]"fs
312 x=x1+2:y=y+1:gosub66:print"ave. ";
313 x=x1+12-len(str$(ave)):gosub66:print"[144]"ave
316 x=x1+2:y=y+2:gosub66:print"[156]games";
317 x=x1+12-len(str$(g7)):gosub66:print"[144]"g7
320 x=x1+2:y=y+1:gosub66:print"[156]wins ";
321 x=x1+12-len(str$(nw)):gosub66:print"[144]"nw
326 return
328 :
329 rem clear message
330 sysmt+30,0,16,1,1,kt,sk
332 return
366 :
367 rem declare win
368 ifso=0thengosub26
370 nw=nw+1:wf=1
372 x1=21:x2=34:y1=2:y2=06:cl=2:gosub2300
374 y=y1+2:x=x1+3:gosub66:print"youwin ":return
388 :
389 rem update stats
390 g7=g7+1:t6=0:
391 fori=sftonp:t6=t6+c(i):next
392 fs=t6-pn:g8=g8+fs:av=int(g8/g7+.5):ift6<lothenlo=t6
394 ift6>hithenhi=t6
395 ifg7=1thenhi=t6:lo=t6
396 iffs<37ort6<52then399
397 nw=nw+1:ifso=0thengosub26
399 wf=0:return
408 :
409 rem alternate heading
410 ifsd=1thenpoke53269,1:return
414 fori=1to20:gosub65:print"[144][145]"mid$(sc$,i,1):next
420 poke53269,0: return
438 :
439 rem spread graphics
440 print"[146]":ifk>36then442
441 x=1:y=4:forj=1tok:gosub66:c(i)=j:gosub202:x=x+1:next:goto447
442 x=1:y=4:forj=1to36:gosub66:c(i)=j:gosub202:x=x+1:next:ifk>72then445
444 x=1:y=10:forj=37tok:gosub66:c(i)=j:gosub202:x=x+1:next:goto447
445 x=1:y=10:forj=37to72:gosub66:c(i)=j:gosub202:x=x+1:next
446 x=1:y=16:forj=73tok :gosub66:c(i)=j:gosub202:x=x+1:next
447 return
480 :
481 rem menu opening
482 gosub5000
484 onigoto500,486,488,39000
486 gosub5400:goto482
488 ifrd%(1)=0andrd%(2)=0thenwm=0:gosub330: gosub90:gosub5000:goto484
490 goto502
498 :
499 new game
500 fori=1tonc:rd%(i) =s(i-1):next:c(0)=nc:kd=fl(2):ifrd=0thenkd=fl(3)
502 sysmt+42,216:fori=1tonp:c(i)=0:next
503 sysmt:gosub410
504 fori=1tonc:b%(0,i)=rd%(i):next:c(0)=nc
506 forj=1to13:i=2:c(i)=c(i)+1:b%(i,c(i))=b%(0,c(0)):c(0)=c(0)-1
510 sysmt+30,x(2),x(2)+3,y(2),y(2)+4,kc%(kc),cc: gosub250: next: gosub230
512 fori=lttogt:c(i)=c(i)+1:b%(i,c(i))=b%(0,c(0)):c(0)=c(0)-1:gosub200:next
524 i=0:gosub250:gosub230:pn=0:xc=0:re=0
532 fork=0tonp:mm(k)=c(k):oo(k)=b%(k,1):next: z0=re:sysmt+39,144 :pp=pn
534 gosub330:print"[146]";:wm=4
535 y= 1:x=07-(len(wm$(wm)))/2:gosub66:printwm$(wm);
537 ch$=fr$:pokev+1,28 :gosub20:ifsd=1and rg%=0thenwm=08: gosub90:goto534
538 gosub330:ifi>6then544
540 onigoto3000,1620,850,4004,4000,534
542 wf=1:x1=21:x2=34:
543 y1=2:y2=6:cl=2:gosub2300:y=4:x=24:gosub66:print"youwin ":goto4000
544 fr=i-7 :xn=0:iffr>gfthen900
545 iffr>=sfandfr<=sf+3then1900
548 ifrd=0then556
552 fork=0tonp:mm(k)=c(k):oo(k)=b%(k,1):next:z0=re:sysmt+39,144 :pp=pn
556 ifr2%=1orfr=0then568
560 ifc(fr)=0then wm=1:gosub90:goto534
564 goto600
568 ifc(0)=0andc(1)=0thenwm=1:gosub90:goto534
572 ifc(0)=0thengosub260:goto534
576 c(1)=c(1)+1:b%(1,c(1))=b%(0,c(0)):c(0)=c(0)-1:i=1:gosub200
580 i=0:gosub230:goto534
600 gosub330:print"[146]";:wm